<template>
  <div>
    <el-table
      :data="tableData"
      border
      style="width: 100%">

      <el-table-column
        prop="systemName"
        label="系统名称"
        width="180">
      </el-table-column>

      <el-table-column
        prop="beginTime"
        label="巡检开始时间"
        width="180">
      </el-table-column>

      <el-table-column
        prop="baseInfomation"
        label="问题描述">
      </el-table-column>

      <el-table-column
        prop="seriousState"
        label="问题状态"
        width="180">
        <template slot-scope="scope">
          <span v-if="scope.row.seriousState == 1">严重</span>
          <span v-if="scope.row.seriousState == 0">预警</span>
          <span v-if="scope.row.seriousState == 2">未开始</span>
          <span v-if="scope.row.seriousState == 3">正常</span>
        </template>
      </el-table-column>
    </el-table>

  </div>
</template>

<script>  window._interceptConfig = {
  collection: true, //整体开关
  click: true, //页面点击事件信息采集开关
  page: true, //页面跳转加载事件信息采集开关
  error: true, //异常信息采集开关
  http: true, //通讯信息采集开关
  name: "jyzdhywxxxtsdfx_n_prd.mart-ui-ds", //系统编号，被采集信息的系统名称。前端简称
  url: " http://apm.sd.sgcc.com.cn:19411/api/v2/spansWeb"//数据上报服务地址，根据实际情况输入
};
</script>
<!-- src -->
<script src=" http://25.41.37.249:19411/assets/js/intercept.min.js " async></script>
<script>
  import {getSystemByDBId} from "@/api/diagmanage/stateReport"
  import moment from "moment"
  export default {
    props: ['dbId','beginTime','systemName'],
    data() {
      return {
        tableData: [],
        formInline: {

        },
        currentPage:1,
        pageSize:10,
        total:0
      }
    },
    methods:{

      formatData(time){

      },

      init(reportId,beginTime,systemName){
        if (reportId == '00'){
          this.tableData = [
            {
              seriousState:'3',
              baseInfomation:'计算文本文件中的单词数',
              beginTime:beginTime,
              systemName:systemName
            },
            {
              seriousState:'3',
              beginTime:beginTime,
              baseInfomation:'查找和替换文本',
              systemName:systemName
            },
            {
              seriousState:'3',
              beginTime:beginTime,
              baseInfomation:'生成随机文本',
              systemName:systemName
            },
            {
              beginTime:beginTime,
              seriousState:'3',
              baseInfomation:'自动化表单提交',
              systemName:systemName
            }
          ]
        }else {
          getSystemByDBId(reportId).then(res=>{
            this.tableData = res.data
            let Btime =  beginTime
            this.tableData.forEach(x=>{
              if (beginTime.startsWith("2024")){
                Btime = moment(Btime).add(5,'minutes').format("YYYY-MM-DD HH:mm:ss")
                x.beginTime = Btime
              }else {
                x.beginTime = '-'
                x.seriousState = 2
                x.baseInfomation = '未开始'
              }
            })
          })
        }



      },
    },
    created(){
    }
  }
</script>

<style scoped>
</style>
